﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Threading;
using System.Windows.Threading;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Collections.Concurrent;

namespace FishingSearch
{
    /// <summary>
    /// Interaction logic for ProgressBar_BackgroundWorker.xaml
    /// </summary>
    public partial class ProgressWindow : Window
    {

        public ProgressWindow()
        {
            InitializeComponent();
       }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.btnCancel.Visibility = Visibility.Hidden;

            Action action = new Action(() =>
            {
                MainWindow.bw.CancelAsync();
                //MainWindow._resetEvent.WaitOne();
            }
            );

            this.Dispatcher.Invoke(action, DispatcherPriority.ApplicationIdle);

            MessageInfo miCancel;
            miCancel = new MessageInfo("Operazione interrotta.", this);
            miCancel.ShowDialog();
            this.Close();

        }

  }
}

